<?php
/**
 * Created by PhpStorm.
 * User: 程序猴
 * Date: 2018/4/19
 *  Q Q: 505413
 * Time: 9:50
 */

namespace app\admin\controller;
use app\admin\controller\Base;
use think\Db;
class Log extends Base
{
     public function index()
     {
     	$data = Db::name('login_log')->order('create_time desc')->select();
       $this->assign('data',$data);
     	return $this->fetch();
     }
 	//删除日志
    public function logDel()
    {
        $id = input('id');
        $res = Db::name('login_log')->where(array('id'=>$id))->delete();
        if($res){
            return json(['code' => 1, 'url' => 'log/index', 'msg' => '删除成功']);
        }else{
            return json(['code' => -1, 'url' => 'log/index', 'msg' => '删除失败，请重试']);
        }
    }
}